package test;

import java.util.Scanner;

public class Question3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        long sum = 0;
        long posSum = 0;
        long negSum = 0;
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
            sum += a[i];
            if(a[i] > 0) posSum += a[i];
            else negSum += a[i];
        }
        long ans = Math.abs(sum);
        long candidate1 = Math.abs(sum - 2*posSum);
        if(candidate1 > ans) ans = candidate1;

        long candidate2 = Math.abs(sum - 2*negSum);
        if(candidate2 > ans) ans = candidate2;
        System.out.println(ans);
    }
}
